package com.liang.design;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author lsm
 * @ClassName ActivityFactory.java
 * @Description 享元工厂
 * @createTime 2023年12月05日 10:37:00
 */
public class ActivityFactory {

    static Map<Long,Activity> activityMap = new HashMap<Long,Activity>();

    public static Activity getActivity(Long id){
        Activity activity = activityMap.get(id);
        if (null == activity){
            //获取活动信息
            activity = new Activity();
            activity.setId(10001L);
            activity.setName("图书嗨乐");
            activity.setDesc("图书优惠券分享激励分享活动第⼆二期");
            activity.setStartTime(new Date());
            activity.setStopTime(new Date());
            activityMap.put(id, activity);
        }
        return activity;
    }
}
